(function () {
    $("#usernameLabel").text(localStorage.getItem("usernameLabel"))
    $("#usernameLabel").text(sessionStorage.getItem("usernameLabel"))
    if (localStorage.getItem("rememberMe") === "0") {
        token = sessionStorage.getItem("token")
    } else {
        token = localStorage.getItem("token")
    }
})()
$(".logout").click(function () {
    $.ajax({
        url: "/user/logout",
        type: "POST",
        dataType: 'json',
        headers: {"Content-Type": "application/json;charset=utf-8", 'Authorization': token},
        success(data) {
            if (data.code === 200) {

            }

        }
    })
    localStorage.removeItem("token")
    sessionStorage.removeItem("token")
    localStorage.removeItem("userIdP")
    sessionStorage.removeItem("userIdP")
    localStorage.removeItem("userName")
    sessionStorage.removeItem("userName")
    localStorage.removeItem("usernameLabel")
    sessionStorage.removeItem("usernameLabel")
    $("#usernameLabel").text("请登录")
    location.href = encodeURI("login.html")
})
